<template>
    <Form ref="listedCompany" :model="listedCompany" :rules="ruleValidate" :label-width="150">
        <FormItem label="编号" prop="number">
            <Input v-model="listedCompany.number" placeholder="系统自动生成编号，不可更改" disabled></Input>
        </FormItem>
        <FormItem label="企业名称" prop="company_name" >
            <Input v-model="listedCompany.company_name"  placeholder="企业名称" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="注册地址" prop="registerde_address">
            <Input v-model="listedCompany.registerde_address" placeholder="注册地址" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="注册资本" prop="registered_capital">
            <InputNumber :min="0" v-model="listedCompany.registered_capital" :disabled ="Disabled"></InputNumber>
        </FormItem>
        <Row>
            <Col span=4>
                <FormItem label="总股本" prop="total_equity">
                    <InputNumber :min="0" v-model="listedCompany.total_equity" :disabled ="Disabled"></InputNumber>
                </FormItem>
            </Col>
            <Col span=4>
                <FormItem label="国有股" >
                    <InputNumber :min="0" v-model="listedCompany.state_owned_shares" :disabled ="Disabled"></InputNumber>
                </FormItem>
            </Col>
            <Col span=4>
                <FormItem label="法人股" >
                    <InputNumber :min="0" v-model="listedCompany.legal_person_share" :disabled ="Disabled"></InputNumber>
                </FormItem>
            </Col>
            <Col span=4>
                <FormItem label="自然人股" >
                    <InputNumber :min="0" v-model="listedCompany.natural_person_shares" :disabled ="Disabled"></InputNumber>
                </FormItem>
            </Col>
        </Row>
        <FormItem label="设立时间" prop="formated_create_time">
            <DatePicker type="year" placeholder="选择设立时间" v-model="listedCompany.formated_create_time" :disabled ="Disabled"></DatePicker>
        </FormItem>
        <FormItem label="控股股东" prop="controlling_shareholder">
            <Input v-model="listedCompany.controlling_shareholder" placeholder="控股股东" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="法人代表" prop="legal_representative">
            <Input v-model="listedCompany.legal_representative" placeholder="法人代表姓名" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="联系人" prop="contact_person">
            <Input v-model="listedCompany.contact_person" placeholder="联系人姓名" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="移动电话" prop="mobile_phone">
            <Input v-model="listedCompany.mobile_phone" placeholder="移动电话" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="办公电话" prop="office_phone">
            <Input v-model="listedCompany.office_phone" placeholder="办公电话" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="所属行业" prop="industry_involved">    
            <Select v-model="listedCompany.industry_involved" placeholder="所属行业" :disabled ="Disabled">
                <Option :value="item.name" v-for="(item,index) in industry_involved_tree.children" :key="index">{{item.name}}</Option>
            </Select>
        </FormItem>
        <FormItem label="主营业务" prop="main_business" >
            <Input  type="textarea" v-model="listedCompany.main_business" placeholder="主营业务" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="企业性质" prop="enterprise_nature">    
            <Select v-model="listedCompany.enterprise_nature" placeholder="企业性质" :disabled ="Disabled">
                <Option :value="item.name" v-for="(item,index) in enterprise_nature_tree.children" :key="index">{{item.name}}</Option>
            </Select>
        </FormItem>
        <FormItem label="是否高新技术企业">
            <RadioGroup v-model="listedCompany.high_tech_enterprise" :disabled ="Disabled">
                <Radio label="是" :disabled ="Disabled">是</Radio>
                <Radio label="否" :disabled ="Disabled">否</Radio>
            </RadioGroup>
        </FormItem>
        <FormItem label="是否贫困县" prop="poverty_level">    
            <Select v-model="listedCompany.poverty_level" placeholder="选择是否贫困县和贫困等级" :disabled ="Disabled">
                <Option value="非贫困县">非贫困县</Option>
                <Option value="国家级">国家级</Option>
                <Option value="集中连片特困地区">集中连片特困地区</Option>
                <Option value="省级">省级</Option>
            </Select>
        </FormItem>
        <FormItem label="是否省级扶贫龙头企业">
            <RadioGroup v-model="listedCompany.Anti_poverty_leading_enterprise">
                <Radio label="是" :disabled ="Disabled">是</Radio>
                <Radio label="否" :disabled ="Disabled">否</Radio>
            </RadioGroup>
        </FormItem>
        <FormItem label="改制时间" prop="formated_restructurt_time">
            <DatePicker type="year" placeholder="选择改制时间" v-model="listedCompany.formated_restructurt_time" :disabled ="Disabled"></DatePicker>
        </FormItem>
        <FormItem label="股份公司设立形式" prop="corporation_set_up_form">    
            <Select v-model="listedCompany.corporation_set_up_form" placeholder="选择股份公司设立形式" :disabled ="Disabled">
                <Option value="有限公司整体变更">有限公司整体变更</Option>
                <Option value="发起设立">发起设立</Option>
                <Option value="募集设立">募集设立</Option>
                <Option value="其他">其他</Option>
            </Select>
        </FormItem>
        <FormItem label="辅导机构" prop="counselling_organization">
            <Input  v-model="listedCompany.counselling_organization" placeholder="辅导机构" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="保荐机构（人）" prop="sponsor">
            <Input v-model="listedCompany.sponsor" placeholder="保荐机构（人）" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="律师事务所" prop="law_firm">
            <Input v-model="listedCompany.law_firm" placeholder="律师事务所" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="会计师事务所" prop="Account_firm">
            <Input v-model="listedCompany.Account_firm" placeholder="会计师事务所" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="时间安排" prop="formated_schedule">
            <DatePicker type="year" placeholder="时间安排" v-model="listedCompany.formated_schedule" :disabled ="Disabled"></DatePicker>
        </FormItem>
        <FormItem label="上市板块" >
            <RadioGroup v-model="listedCompany.board" @on-change="chooseBoard" >
                <Radio label="inside" :disabled ="Disabled">境内</Radio>
                <Radio label="abroad" :disabled ="Disabled">境外</Radio>
            </RadioGroup>
        </FormItem>
        <FormItem label="选择境内板块" v-if="listedCompany.board==='inside'? true:false" prop="listed_sector">    
            <Select v-model="listedCompany.listed_sector" placeholder="选择境内板块" :disabled ="Disabled">
                <Option value="主板" :disabled ="Disabled">主板</Option>
                <Option value="中小板" :disabled ="Disabled">中小板</Option>
                <Option value="创业板" :disabled ="Disabled">创业板</Option>
                <Option value="新三板" :disabled ="Disabled">新三板</Option>
                <Option value="石交所" :disabled ="Disabled">石交所</Option>
            </Select>
        </FormItem>
        <FormItem label="注明境外板块"  v-if="listedCompany.board==='abroad'? true:false" prop="listed_sector">
            <Input v-model="listedCompany.listed_sector" placeholder="注明境外板块" :disabled ="Disabled"></Input>
        </FormItem>
        <FormItem label="上市状态">
            <RadioGroup v-model="listedCompany.list_status" >
                <Radio label="拟上市" :disabled ="Disabled">拟上市</Radio>
                <Radio label="已上市" :disabled ="Disabled">已上市</Radio>
            </RadioGroup>
        </FormItem>
    </Form>
</template>
<script>
    import Vue from 'vue';
import listedCompanyVue from '../../admin/views/plateformservice/listedCompany.vue';
    export default {
        name: "CompleteListedCompanyPage",
        props:{
            listedCompany:{
                type: Object
            },
            Disabled:{
                type: Boolean,
                default: false
            }
        },
        data() {
            return {
                ruleValidate:{
                    company_name: [
                        { required: true, message: '企业名称不能为空！', trigger: 'change' }
                    ],
                    registered_capital: [
                        { required: true, type: "integer", min: 1, message: '注册资本大于等于1（万元）！', trigger: 'change' }
                    ],
                    registerde_address: [
                        { required: true, message: '企业名称不能为空！', trigger: 'change' }
                    ],
                    formated_create_time: [
                        { required: true, type: "date", message: '企业成立时间不能为空！', trigger: 'change' }
                    ],
                    total_equity:[
                        { required: true, type: "integer", min: 1, message: '总股本大于等于1（万元）！', trigger: 'change' }
                    ],
                    controlling_shareholder: [
                        { required: true, message: '控股股东不能为空！', trigger: 'change' }
                    ],
                    legal_representative: [
                        { required: true, message: '法人代表不能为空！', trigger: 'change' }
                    ],
                    contact_person: [
                        { required: true, message: '联系人不能为空！', trigger: 'change' }
                    ],
                    mobile_phone: [
                        { required: true, message: '移动电话不能为空！', trigger: 'change' }
                    ],
                    office_phone: [
                        { required: true, message: '办公电话不能为空！', trigger: 'change' }
                    ],
                    industry_involved: [
                        { required: true, message: '所属行业不能为空！', trigger: 'change' }
                    ],
                    main_business: [
                        { required: true, message: '主营业务不能为空！', trigger: 'change' }
                    ],
                    enterprise_nature: [
                        { required: true, message: '企业性质不能为空！', trigger: 'change' }
                    ],
                    poverty_level: [
                        { required: true, message: '请选择贫困等级！', trigger: 'change' }
                    ],
                    formated_restructurt_time: [
                        { required: true, type: "date" ,message: '改制时间不能为空！', trigger: 'change' }
                    ],
                    corporation_set_up_form: [
                        { required: true, message: '公司设立形式不能为空！', trigger: 'change' }
                    ],  
                    counselling_organization: [
                        { required: true, message: '辅导机构不能为空！', trigger: 'change' }
                    ], 
                    sponsor: [
                        { required: true, message: '保荐机构（人）不能为空！', trigger: 'change' }
                    ], 
                    law_firm: [
                        { required: true, message: '律师事务所不能为空！', trigger: 'change' }
                    ], 
                    Account_firm: [
                        { required: true, message: '会计事务所不能为空！', trigger: 'change' }
                    ], 
                    formated_schedule: [
                        { required: true, type: "date", message: '时间安排不能为空！', trigger: 'change' }
                    ],
                    listed_sector: [
                        { required: true, message: '上市板块不能为空！', trigger: 'change' }
                    ]   
                },
            }
        },
        methods:{
          chooseBoard() {
            this.$emit("ListenBoardEvent",this.listedCompany.board); 
          },
          validate(callback) {
            this.$refs["listedCompany"].validate( valid => {
                callback(valid);
            });
          }
        },
    computed: {
        enterprise_nature_tree() {
            return this.$store.state.app.dicTree["company_type"];
        },
        industry_involved_tree() {
            return this.$store.state.app.dicTree["industry"];
        }
    },
    }
</script>
